// packageE/goods/goods.js
var app = getApp();
Component({
  properties: {
    datas: {
      type: null,
    },
    page_id: {
      type: null,
    },
    component_id: {
      type: null,
    },
    bottomShowBolIndex: {
      type: null,
    },
    index: {
      type: null,
    },
    U_tabcontrol: {
      type: null,
    },
    bottomShowBol: {
      type: null,
    },
    isLast: {
      type: null,
    },
  },
  // 私有数据，可用于模板渲染
  data: {
    integral: "积分",
    emptyImage:  `${app.globalData.imgPath}image.png`,
    clientWidth: "375",
    list: [],
    language: "",
    goodsShow: true,

    page: 1,
    total_page: 0,
    isLoadMore: true,
    allLoaded: false, // 全部数据已经加载完成
    imgPath: app.globalData.imgPath,
  },

  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached() {
      let language = wx.getStorageSync("langIndex");
      this.setData({
        language: language.en
      });

      let value = wx.getStorageSync("integral");
      if (value) {
        this.setData({
          integral: value,
        });
      }
    },
    moved() {},
    detached() {},
  },

  // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
  attached() {},
  // 此处attached的声明会被lifetimes字段中的声明覆盖
  ready() {
    this.setData({
      clientWidth: wx.getSystemInfoSync().windowWidth,
    });
    this.setData({
      list: this.data.datas.list,
    });
  },

  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show() {},
    hide() {},
    resize() {},
  },
  methods: {
    gotoDetail(e) {
      let id = e.currentTarget.dataset.item.id;
      wx.navigateTo({
        url: `/mircoApp/giftPackage/giftGoodsList/giftGoodsList?id=${id}`,
      });
    },
  },
  observers: {
  },
});